{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "7c947b98-8336-4d39-815a-f1538df6d495",
   "metadata": {},
   "outputs": [],
   "source": [
    "import polars as pl\n",
    "from perspective.widget import PerspectiveWidget \n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "579443ea-bcc1-4735-bd29-72a9a4303f2e",
   "metadata": {},
   "outputs": [],
   "source": [
    "d1 = pl.read_parquet('new_share.parquet')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "eaa52be0-9883-474a-8f2b-45cec3df250d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (2_000, 12)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>ts_code</th><th>sub_code</th><th>name</th><th>ipo_date</th><th>issue_date</th><th>amount</th><th>market_amount</th><th>price</th><th>pe</th><th>limit_amount</th><th>funds</th><th>ballot</th></tr><tr><td>str</td><td>str</td><td>str</td><td>date</td><td>date</td><td>f64</td><td>f64</td><td>f64</td><td>f64</td><td>f64</td><td>f64</td><td>f64</td></tr></thead><tbody><tr><td>&quot;301636.SZ&quot;</td><td>&quot;301636&quot;</td><td>&quot;泽润新能&quot;</td><td>2025-04-28</td><td>null</td><td>1597.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.45</td><td>0.0</td><td>0.0</td></tr><tr><td>&quot;001400.SZ&quot;</td><td>&quot;001400&quot;</td><td>&quot;江顺科技&quot;</td><td>2025-04-15</td><td>null</td><td>1500.0</td><td>1500.0</td><td>37.36</td><td>15.32</td><td>1.5</td><td>5.604</td><td>0.01</td></tr><tr><td>&quot;301560.SZ&quot;</td><td>&quot;301560&quot;</td><td>&quot;众捷汽车&quot;</td><td>2025-04-15</td><td>null</td><td>3040.0</td><td>1216.0</td><td>16.5</td><td>21.3</td><td>0.7</td><td>5.016</td><td>0.02</td></tr><tr><td>&quot;603202.SH&quot;</td><td>&quot;732202&quot;</td><td>&quot;天有为&quot;</td><td>2025-04-14</td><td>null</td><td>4000.0</td><td>2611.0</td><td>93.5</td><td>13.5</td><td>1.25</td><td>37.4</td><td>0.03</td></tr><tr><td>&quot;301662.SZ&quot;</td><td>&quot;301662&quot;</td><td>&quot;宏工科技&quot;</td><td>2025-04-08</td><td>2025-04-17</td><td>2000.0</td><td>813.0</td><td>26.6</td><td>7.05</td><td>0.45</td><td>5.32</td><td>0.02</td></tr><tr><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td></tr><tr><td>&quot;002953.SZ&quot;</td><td>&quot;002953&quot;</td><td>&quot;日丰股份&quot;</td><td>2019-04-24</td><td>2019-05-09</td><td>4302.0</td><td>3872.0</td><td>10.52</td><td>16.34</td><td>1.7</td><td>4.526</td><td>0.03</td></tr><tr><td>&quot;603697.SH&quot;</td><td>&quot;732697&quot;</td><td>&quot;有友食品&quot;</td><td>2019-04-23</td><td>2019-05-08</td><td>7950.0</td><td>7155.0</td><td>7.87</td><td>13.92</td><td>3.1</td><td>6.257</td><td>0.05</td></tr><tr><td>&quot;300772.SZ&quot;</td><td>&quot;300772&quot;</td><td>&quot;运达股份&quot;</td><td>2019-04-17</td><td>2019-04-26</td><td>7349.0</td><td>6614.0</td><td>6.52</td><td>22.97</td><td>2.8</td><td>4.792</td><td>0.04</td></tr><tr><td>&quot;603967.SH&quot;</td><td>&quot;732967&quot;</td><td>&quot;中创物流&quot;</td><td>2019-04-17</td><td>2019-04-29</td><td>6667.0</td><td>6000.0</td><td>15.32</td><td>22.24</td><td>2.6</td><td>10.213</td><td>0.04</td></tr><tr><td>&quot;300773.SZ&quot;</td><td>&quot;300773&quot;</td><td>&quot;拉卡拉&quot;</td><td>2019-04-16</td><td>2019-04-25</td><td>4001.0</td><td>3601.0</td><td>33.28</td><td>22.99</td><td>1.2</td><td>13.315</td><td>0.04</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (2_000, 12)\n",
       "┌───────────┬──────────┬──────────┬────────────┬───┬───────┬──────────────┬────────┬────────┐\n",
       "│ ts_code   ┆ sub_code ┆ name     ┆ ipo_date   ┆ … ┆ pe    ┆ limit_amount ┆ funds  ┆ ballot │\n",
       "│ ---       ┆ ---      ┆ ---      ┆ ---        ┆   ┆ ---   ┆ ---          ┆ ---    ┆ ---    │\n",
       "│ str       ┆ str      ┆ str      ┆ date       ┆   ┆ f64   ┆ f64          ┆ f64    ┆ f64    │\n",
       "╞═══════════╪══════════╪══════════╪════════════╪═══╪═══════╪══════════════╪════════╪════════╡\n",
       "│ 301636.SZ ┆ 301636   ┆ 泽润新能 ┆ 2025-04-28 ┆ … ┆ 0.0   ┆ 0.45         ┆ 0.0    ┆ 0.0    │\n",
       "│ 001400.SZ ┆ 001400   ┆ 江顺科技 ┆ 2025-04-15 ┆ … ┆ 15.32 ┆ 1.5          ┆ 5.604  ┆ 0.01   │\n",
       "│ 301560.SZ ┆ 301560   ┆ 众捷汽车 ┆ 2025-04-15 ┆ … ┆ 21.3  ┆ 0.7          ┆ 5.016  ┆ 0.02   │\n",
       "│ 603202.SH ┆ 732202   ┆ 天有为   ┆ 2025-04-14 ┆ … ┆ 13.5  ┆ 1.25         ┆ 37.4   ┆ 0.03   │\n",
       "│ 301662.SZ ┆ 301662   ┆ 宏工科技 ┆ 2025-04-08 ┆ … ┆ 7.05  ┆ 0.45         ┆ 5.32   ┆ 0.02   │\n",
       "│ …         ┆ …        ┆ …        ┆ …          ┆ … ┆ …     ┆ …            ┆ …      ┆ …      │\n",
       "│ 002953.SZ ┆ 002953   ┆ 日丰股份 ┆ 2019-04-24 ┆ … ┆ 16.34 ┆ 1.7          ┆ 4.526  ┆ 0.03   │\n",
       "│ 603697.SH ┆ 732697   ┆ 有友食品 ┆ 2019-04-23 ┆ … ┆ 13.92 ┆ 3.1          ┆ 6.257  ┆ 0.05   │\n",
       "│ 300772.SZ ┆ 300772   ┆ 运达股份 ┆ 2019-04-17 ┆ … ┆ 22.97 ┆ 2.8          ┆ 4.792  ┆ 0.04   │\n",
       "│ 603967.SH ┆ 732967   ┆ 中创物流 ┆ 2019-04-17 ┆ … ┆ 22.24 ┆ 2.6          ┆ 10.213 ┆ 0.04   │\n",
       "│ 300773.SZ ┆ 300773   ┆ 拉卡拉   ┆ 2019-04-16 ┆ … ┆ 22.99 ┆ 1.2          ┆ 13.315 ┆ 0.04   │\n",
       "└───────────┴──────────┴──────────┴────────────┴───┴───────┴──────────────┴────────┴────────┘"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "8d0e2208-4b05-4ae2-94bb-b320053d7c3c",
   "metadata": {},
   "outputs": [],
   "source": [
    "d2 = pl.read_parquet('stock_basic.parquet')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "af3d4ca9-ca8d-4774-afba-cfe79f0c1949",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (5_412, 17)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>ts_code</th><th>symbol</th><th>name</th><th>area</th><th>industry</th><th>fullname</th><th>enname</th><th>cnspell</th><th>market</th><th>exchange</th><th>curr_type</th><th>list_status</th><th>list_date</th><th>delist_date</th><th>is_hs</th><th>act_name</th><th>act_ent_type</th></tr><tr><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>date</td><td>null</td><td>str</td><td>str</td><td>str</td></tr></thead><tbody><tr><td>&quot;000001.SZ&quot;</td><td>&quot;000001&quot;</td><td>&quot;平安银行&quot;</td><td>&quot;深圳&quot;</td><td>&quot;银行&quot;</td><td>&quot;平安银行股份有限公司&quot;</td><td>&quot;Ping An Bank Co., Ltd.&quot;</td><td>&quot;payh&quot;</td><td>&quot;主板&quot;</td><td>&quot;SZSE&quot;</td><td>&quot;CNY&quot;</td><td>&quot;L&quot;</td><td>1991-04-03</td><td>null</td><td>&quot;S&quot;</td><td>&quot;无实际控制人&quot;</td><td>&quot;无&quot;</td></tr><tr><td>&quot;000002.SZ&quot;</td><td>&quot;000002&quot;</td><td>&quot;万科A&quot;</td><td>&quot;深圳&quot;</td><td>&quot;全国地产&quot;</td><td>&quot;万科企业股份有限公司&quot;</td><td>&quot;China Vanke Co.,Ltd.&quot;</td><td>&quot;wka&quot;</td><td>&quot;主板&quot;</td><td>&quot;SZSE&quot;</td><td>&quot;CNY&quot;</td><td>&quot;L&quot;</td><td>1991-01-29</td><td>null</td><td>&quot;S&quot;</td><td>&quot;深圳市人民政府国有资产监督管理委员会&quot;</td><td>&quot;地方国企&quot;</td></tr><tr><td>&quot;000004.SZ&quot;</td><td>&quot;000004&quot;</td><td>&quot;国华网安&quot;</td><td>&quot;深圳&quot;</td><td>&quot;软件服务&quot;</td><td>&quot;深圳国华网安科技股份有限公司&quot;</td><td>&quot;Shenzhen Guohua Network Securi…</td><td>&quot;ghwa&quot;</td><td>&quot;主板&quot;</td><td>&quot;SZSE&quot;</td><td>&quot;CNY&quot;</td><td>&quot;L&quot;</td><td>1991-01-14</td><td>null</td><td>&quot;N&quot;</td><td>&quot;李映彤&quot;</td><td>&quot;民营企业&quot;</td></tr><tr><td>&quot;000006.SZ&quot;</td><td>&quot;000006&quot;</td><td>&quot;深振业A&quot;</td><td>&quot;深圳&quot;</td><td>&quot;区域地产&quot;</td><td>&quot;深圳市振业(集团)股份有限公司&quot;</td><td>&quot;Shenzhen Zhenye(Group) Co., Lt…</td><td>&quot;szya&quot;</td><td>&quot;主板&quot;</td><td>&quot;SZSE&quot;</td><td>&quot;CNY&quot;</td><td>&quot;L&quot;</td><td>1992-04-27</td><td>null</td><td>&quot;S&quot;</td><td>&quot;深圳市人民政府国有资产监督管理委员会&quot;</td><td>&quot;地方国企&quot;</td></tr><tr><td>&quot;000007.SZ&quot;</td><td>&quot;000007&quot;</td><td>&quot;全新好&quot;</td><td>&quot;深圳&quot;</td><td>&quot;其他商业&quot;</td><td>&quot;深圳市全新好股份有限公司&quot;</td><td>&quot;Shenzhen Quanxinhao Co,.Ltd.&quot;</td><td>&quot;qxh&quot;</td><td>&quot;主板&quot;</td><td>&quot;SZSE&quot;</td><td>&quot;CNY&quot;</td><td>&quot;L&quot;</td><td>1992-04-13</td><td>null</td><td>&quot;N&quot;</td><td>&quot;王玩虹&quot;</td><td>&quot;民营企业&quot;</td></tr><tr><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td></tr><tr><td>&quot;920111.BJ&quot;</td><td>&quot;920111&quot;</td><td>&quot;聚星科技&quot;</td><td>null</td><td>null</td><td>&quot;温州聚星科技股份有限公司&quot;</td><td>&quot;Wenzhou Juxing Science And Tec…</td><td>&quot;jxkj&quot;</td><td>&quot;北交所&quot;</td><td>&quot;BSE&quot;</td><td>&quot;CNY&quot;</td><td>&quot;L&quot;</td><td>2024-11-11</td><td>null</td><td>&quot;N&quot;</td><td>null</td><td>null</td></tr><tr><td>&quot;920116.BJ&quot;</td><td>&quot;920116&quot;</td><td>&quot;星图测控&quot;</td><td>null</td><td>null</td><td>&quot;中科星图测控技术股份有限公司&quot;</td><td>&quot;Geovis Insighter Technology Co…</td><td>&quot;xtck&quot;</td><td>&quot;北交所&quot;</td><td>&quot;BSE&quot;</td><td>&quot;CNY&quot;</td><td>&quot;L&quot;</td><td>2025-01-02</td><td>null</td><td>&quot;N&quot;</td><td>null</td><td>null</td></tr><tr><td>&quot;920118.BJ&quot;</td><td>&quot;920118&quot;</td><td>&quot;太湖远大&quot;</td><td>null</td><td>null</td><td>&quot;浙江太湖远大新材料股份有限公司&quot;</td><td>&quot;Zhejiang Taihu Yuanda New Mate…</td><td>&quot;thyd&quot;</td><td>&quot;北交所&quot;</td><td>&quot;BSE&quot;</td><td>&quot;CNY&quot;</td><td>&quot;L&quot;</td><td>2024-08-22</td><td>null</td><td>&quot;N&quot;</td><td>null</td><td>null</td></tr><tr><td>&quot;920128.BJ&quot;</td><td>&quot;920128&quot;</td><td>&quot;胜业电气&quot;</td><td>null</td><td>null</td><td>&quot;胜业电气股份有限公司&quot;</td><td>&quot;Shengye Electric Co., Ltd.&quot;</td><td>&quot;sydq&quot;</td><td>&quot;北交所&quot;</td><td>&quot;BSE&quot;</td><td>&quot;CNY&quot;</td><td>&quot;L&quot;</td><td>2024-11-29</td><td>null</td><td>&quot;N&quot;</td><td>null</td><td>null</td></tr><tr><td>&quot;689009.SH&quot;</td><td>&quot;689009&quot;</td><td>&quot;九号公司-WD&quot;</td><td>&quot;北京&quot;</td><td>&quot;摩托车&quot;</td><td>&quot;九号有限公司&quot;</td><td>&quot;Ninebot Limited&quot;</td><td>&quot;jhgs&quot;</td><td>&quot;科创板&quot;</td><td>&quot;SSE&quot;</td><td>&quot;CNY&quot;</td><td>&quot;L&quot;</td><td>2020-10-29</td><td>null</td><td>null</td><td>null</td><td>null</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (5_412, 17)\n",
       "┌───────────┬────────┬─────────────┬──────┬───┬─────────────┬───────┬─────────────────────────────────┬──────────────┐\n",
       "│ ts_code   ┆ symbol ┆ name        ┆ area ┆ … ┆ delist_date ┆ is_hs ┆ act_name                        ┆ act_ent_type │\n",
       "│ ---       ┆ ---    ┆ ---         ┆ ---  ┆   ┆ ---         ┆ ---   ┆ ---                             ┆ ---          │\n",
       "│ str       ┆ str    ┆ str         ┆ str  ┆   ┆ null        ┆ str   ┆ str                             ┆ str          │\n",
       "╞═══════════╪════════╪═════════════╪══════╪═══╪═════════════╪═══════╪═════════════════════════════════╪══════════════╡\n",
       "│ 000001.SZ ┆ 000001 ┆ 平安银行    ┆ 深圳 ┆ … ┆ null        ┆ S     ┆ 无实际控制人                    ┆ 无           │\n",
       "│ 000002.SZ ┆ 000002 ┆ 万科A       ┆ 深圳 ┆ … ┆ null        ┆ S     ┆ 深圳市人民政府国有资产监督管理  ┆ 地方国企     │\n",
       "│           ┆        ┆             ┆      ┆   ┆             ┆       ┆ 委员会                          ┆              │\n",
       "│ 000004.SZ ┆ 000004 ┆ 国华网安    ┆ 深圳 ┆ … ┆ null        ┆ N     ┆ 李映彤                          ┆ 民营企业     │\n",
       "│ 000006.SZ ┆ 000006 ┆ 深振业A     ┆ 深圳 ┆ … ┆ null        ┆ S     ┆ 深圳市人民政府国有资产监督管理  ┆ 地方国企     │\n",
       "│           ┆        ┆             ┆      ┆   ┆             ┆       ┆ 委员会                          ┆              │\n",
       "│ 000007.SZ ┆ 000007 ┆ 全新好      ┆ 深圳 ┆ … ┆ null        ┆ N     ┆ 王玩虹                          ┆ 民营企业     │\n",
       "│ …         ┆ …      ┆ …           ┆ …    ┆ … ┆ …           ┆ …     ┆ …                               ┆ …            │\n",
       "│ 920111.BJ ┆ 920111 ┆ 聚星科技    ┆ null ┆ … ┆ null        ┆ N     ┆ null                            ┆ null         │\n",
       "│ 920116.BJ ┆ 920116 ┆ 星图测控    ┆ null ┆ … ┆ null        ┆ N     ┆ null                            ┆ null         │\n",
       "│ 920118.BJ ┆ 920118 ┆ 太湖远大    ┆ null ┆ … ┆ null        ┆ N     ┆ null                            ┆ null         │\n",
       "│ 920128.BJ ┆ 920128 ┆ 胜业电气    ┆ null ┆ … ┆ null        ┆ N     ┆ null                            ┆ null         │\n",
       "│ 689009.SH ┆ 689009 ┆ 九号公司-WD ┆ 北京 ┆ … ┆ null        ┆ null  ┆ null                            ┆ null         │\n",
       "└───────────┴────────┴─────────────┴──────┴───┴─────────────┴───────┴─────────────────────────────────┴──────────────┘"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "4f012c30-7946-4aa8-bc73-407083844550",
   "metadata": {},
   "outputs": [],
   "source": [
    "d1=d1.with_columns(\n",
    "    ipo_date=pl.col.ipo_date.str.to_date(\"%Y%m%d\"),\n",
    "    issue_date=pl.col.issue_date.str.to_date(\"%Y%m%d\"),\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "d1132049-ba30-4beb-803f-90e2d40627fb",
   "metadata": {},
   "outputs": [],
   "source": [
    "d2=d2.with_columns(\n",
    "    list_date=pl.col.list_date.str.to_date(\"%Y%m%d\"),\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "3f30d7a4-3ddd-4fb6-8071-e6d81713f4a6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "perspective.widget.widget.PerspectiveWidget"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "PerspectiveWidget "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "4d18ed07-6b64-430e-9c02-f294a1de4669",
   "metadata": {},
   "outputs": [],
   "source": [
    "d1_df = pd.DataFrame(d1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "5a1a43bc-5c2e-41cb-a74a-e484b0e62840",
   "metadata": {},
   "outputs": [],
   "source": [
    "d1_df = d1_df.dropna()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "e3d60cfd-5a47-4e52-90ce-8c395719bf43",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "b791d41350f0436aa4b9f8cebd2894bb",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "PerspectiveWidget(binding_mode='server', columns=['index', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '…"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "PerspectiveWidget(d1_df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "dae1184b-62ef-49e0-a2f5-b8a4023ab8b0",
   "metadata": {},
   "outputs": [],
   "source": [
    "d2_df = pd.DataFrame(d2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "12e71176-6d11-4712-8136-d3fa11f8323e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "bb9c422911454e6eaf6c3e95d9d477d0",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "PerspectiveWidget(binding_mode='server', columns=['index', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '…"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "PerspectiveWidget(d2_df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "7c18c6dd-de12-4bc9-85db-3a837324a9ad",
   "metadata": {},
   "outputs": [],
   "source": [
    "config = '{\"version\":\"3.0.1\",\"plugin\":\"Datagrid\",\"plugin_config\":{\"columns\":{},\"edit_mode\":\"READ_ONLY\",\"scroll_lock\":false},\"columns_config\":{\"5\":{\"number_fg_mode\":\"disabled\",\"number_bg_mode\":\"pulse\"}},\"settings\":true,\"theme\":\"Pro Light\",\"title\":null,\"group_by\":[],\"split_by\":[],\"columns\":[\"index\",\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"New Column 1\"],\"filter\":[],\"sort\":[],\"expressions\":{\"New Column 1\":\"\\\"6\\\"/\\\"5\\\"\"},\"aggregates\":{}}'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "312b4eed-0767-4876-9a13-569969ccde74",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\"version\":\"3.0.1\",\"plugin\":\"Datagrid\",\"plugin_config\":{\"columns\":{},\"edit_mode\":\"READ_ONLY\",\"scroll_lock\":false},\"columns_config\":{\"5\":{\"number_fg_mode\":\"disabled\",\"number_bg_mode\":\"pulse\"}},\"settings\":true,\"theme\":\"Pro Light\",\"title\":null,\"group_by\":[],\"split_by\":[],\"columns\":[\"index\",\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"New Column 1\"],\"filter\":[],\"sort\":[],\"expressions\":{\"New Column 1\":\"\"6\"/\"5\"\"},\"aggregates\":{}}\n"
     ]
    }
   ],
   "source": [
    "print(config)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "2063040c-d9c3-4b98-8603-575653be9903",
   "metadata": {},
   "outputs": [],
   "source": [
    "from pathlib import Path"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "8a100f5f-9c32-4ada-a54e-d225733c2a13",
   "metadata": {},
   "outputs": [],
   "source": [
    "file_path = Path(\"D:/untitled.config.json\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "320bf238-0f1b-4687-b379-c78538edf7a9",
   "metadata": {},
   "outputs": [],
   "source": [
    "config2 = file_path.read_text(encoding=\"utf-8\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "d213aff8-7cc7-410f-b897-48bdf2feb1cc",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\"version\":\"3.0.1\",\"plugin\":\"Datagrid\",\"plugin_config\":{\"columns\":{},\"edit_mode\":\"READ_ONLY\",\"scroll_lock\":false},\"columns_config\":{\"5\":{\"number_fg_mode\":\"disabled\",\"number_bg_mode\":\"pulse\"}},\"settings\":true,\"theme\":\"Pro Light\",\"title\":null,\"group_by\":[],\"split_by\":[],\"columns\":[\"index\",\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"New Column 1\"],\"filter\":[],\"sort\":[],\"expressions\":{\"New Column 1\":\"\\\"6\\\"/\\\"5\\\"\"},\"aggregates\":{}}\n"
     ]
    }
   ],
   "source": [
    "print(config2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "36a4378b-9892-42d0-bd7f-fbcc559a1238",
   "metadata": {},
   "outputs": [],
   "source": [
    "import json"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "1a2538c3-e258-4596-b3d7-89d585026355",
   "metadata": {},
   "outputs": [],
   "source": [
    "d = json.loads(config2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "8984cb2e-ee07-409a-a17c-162c7d1b1854",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'version': '3.0.1',\n",
       " 'plugin': 'Datagrid',\n",
       " 'plugin_config': {'columns': {},\n",
       "  'edit_mode': 'READ_ONLY',\n",
       "  'scroll_lock': False},\n",
       " 'columns_config': {'5': {'number_fg_mode': 'disabled',\n",
       "   'number_bg_mode': 'pulse'}},\n",
       " 'settings': True,\n",
       " 'theme': 'Pro Light',\n",
       " 'title': None,\n",
       " 'group_by': [],\n",
       " 'split_by': [],\n",
       " 'columns': ['index',\n",
       "  '0',\n",
       "  '1',\n",
       "  '2',\n",
       "  '3',\n",
       "  '4',\n",
       "  '5',\n",
       "  '6',\n",
       "  '7',\n",
       "  '8',\n",
       "  '9',\n",
       "  '10',\n",
       "  '11',\n",
       "  'New Column 1'],\n",
       " 'filter': [],\n",
       " 'sort': [],\n",
       " 'expressions': {'New Column 1': '\"6\"/\"5\"'},\n",
       " 'aggregates': {}}"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "a49b7147-dd15-4322-848d-194c6ee76bb0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(d)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "8e2004e6-0218-402f-95e3-bfb7d8331c96",
   "metadata": {},
   "outputs": [],
   "source": [
    "d1_df = d1_df.rename(columns={\"0\": 0})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "a696dc42-92cf-4590-8910-032969264ad6",
   "metadata": {},
   "outputs": [],
   "source": [
    "d2_df = d2_df.rename(columns={\"0\": 0})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "9d820758-8171-4b69-b4ed-4ec6d50fcdec",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = d1_df.merge(d2_df, on=0, how=\"left\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "33cc238f-dc02-4c27-a743-2cbb4bc583d0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "10027f526f6948f8846f17f2f1be3c1d",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "PerspectiveWidget(binding_mode='server', columns=['index', '0', '1_x', '2_x', '3_x', '4_x', '5_x', '6_x', '7_x…"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "PerspectiveWidget(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c131da36-a52c-41b7-a5cb-0c91a21d62a7",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
